package com.lsf.modules.system.mapper;

import com.lsf.modules.system.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

/**
 * 用户
 *
 * @author Alexander
 */
public interface UserMapper extends BaseMapper<User> {

    /**
     * 通过账号查询用户信息
     *
     * @param username 用户名
     * @return {@link User}
     */
    @Select("select * from user where username = #{username} and del_flag = 0")
    User getUserByName(@Param("username")String username);

    /**
     * 通过电话获取用户信息
     *
     * @param phone 电话
     * @return {@link User}
     */
    @Select("select * from user where phone = #{phone} and del_flag = 0")
    User getUserByPhone(@Param("phone") String phone);

    /**
     * 通过电子邮件获取用户信息
     *
     * @param email 电子邮件
     * @return {@link User}
     */
    @Select("select * from user where email = #{email} and del_flag = 0")
    User getUserByEmail(@Param("email")String email);

}




